﻿<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
        xmlns:local="clr-namespace:WetHatLab.OneNote.TaggingKit.edit"
        xmlns:prop="clr-namespace:WetHatLab.OneNote.TaggingKit.Properties"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:TaggingKit="clr-namespace:WetHatLab.OneNote.TaggingKit"
        x:Class="WetHatLab.OneNote.TaggingKit.edit.TagEditor"
        Height="{Binding Source={x:Static prop:Settings.Default},Path=TagEditorWindow_Height,Mode=TwoWay}"
        Width="{Binding Source={x:Static prop:Settings.Default},Path=TagEditorWindow_Width,Mode=TwoWay}"
        MinWidth="350"
        MinHeight="200"
        WindowStartupLocation="CenterOwner"
        x:Name="editTags"
        mc:Ignorable="d"
        ShowInTaskbar="False"
        d:DataContext="{d:DesignInstance IsDesignTimeCreatable=True, Type={x:Type local:TagEditorDesignerModel}}"
        WindowStyle="None" Loaded="Window_Loaded"
        Icon="/OneNoteTaggingKit;component/Resources/tag 32x32.png" Closing="editTags_Closing">
    <Window.Resources>
        <CollectionViewSource Source="{Binding KnownTags}" x:Key="knownTags">
            <CollectionViewSource.SortDescriptions>
                <scm:SortDescription Direction="Ascending" />
            </CollectionViewSource.SortDescriptions>
        </CollectionViewSource>

    </Window.Resources>
    <Window.Background>
        <LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
            <GradientStop Color="Ivory" Offset="0.497"/>
            <GradientStop Color="#FFE1ECF7" Offset="1"/>
        </LinearGradientBrush>
    </Window.Background>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition  Height="Auto"/>
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto" />

        </Grid.ColumnDefinitions>
        <GroupBox Grid.Row="0" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" Margin="10,0,10,0" Background="White" Header="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagEditor_Tags_GroupBox_Title}}"  ToolTip="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagEditor_Tags_GroupBox_ToolTip}}">
            <TaggingKit:TagsPanel  VerticalAlignment="Top" HorizontalAlignment="Left" Tags="{Binding PageTags}"/>
        </GroupBox>
        <ComboBox x:Name="TagComboBox" Grid.Row="1"
			HorizontalAlignment="Stretch"
			VerticalAlignment="Center"
			Margin="10,10,5,10"
			IsEditable="True" StaysOpenOnEdit="True"
			IsTextSearchEnabled="True"
			ToolTip="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagEditor_Tag_ComboBox_Tooltip}}"
			ItemsSource="{Binding Source={StaticResource ResourceKey=knownTags}}" KeyUp="TagDropDown_KeyUp"/>
        <Button x:Name="AddTagButton" Grid.Row="1" Grid.Column="2" Width="20" Height="20" ToolTip="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagEditor_Tag_AddButton_Tooltip}}" Click="AddTagButton_Click" Margin="0,0,5,0">
            <Button.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FF00FF00" Offset="0"/>
                    <GradientStop Color="#FFB0ADAD" Offset="1"/>
                </LinearGradientBrush>
            </Button.Background>
            <TextBlock FontFamily="Segoe UI Symbol" Text="✙" FontSize="16" FontWeight="ExtraBold" TextAlignment="Center" VerticalAlignment="Center" RenderTransformOrigin="0.357,-1.587" Height="23" />
        </Button>
        <Grid Grid.Row="2" Grid.ColumnSpan="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="doneButton" Grid.Column="0" Content="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_SaveButton_Text}}" Width="80" HorizontalAlignment="Center" Margin="10,0,0,5" Click="DoneButton_Click" />
            <Button x:Name="cancelButton" Grid.Column="1" Content="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_CancelButton_Text}}" Width="80" HorizontalAlignment="Center" Margin="10,0,0,5" IsCancel="True"/>
            <Label x:Name="addinVersion" Grid.Column="2" HorizontalAlignment="Right"  VerticalAlignment="Bottom" VerticalContentAlignment="Bottom" Foreground="LightSeaGreen" FontSize="9" Content="{Binding AddinVersion, Mode=OneTime}" />
        </Grid>
    </Grid>
</Window>
